clear
close all
clc
delete *.asv

cd ..\
cd Stored_File

load('Debt_policy_3state.mat');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% Figure 3: Debt Dynamics and Fiscal Reaction Function %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure(1)
subplot(2,2,1)
plot(b1,b11,'k','LineWidth',1)
hold on
plot(b1,b12,'color', [128 128 128]/255,'LineWidth',1)
hold on
plot(b1,b13,'color', [200 200 200]/255,'LineWidth',1)
hold on
plot([min(b1):0.01:max(b1)+0.02],[min(b1):0.01:max(b1)+0.015],'k:','LineWidth',0.1)
hold on
plot(bcrit.*ones(1,length([min(b1):0.01:min(b11)])),[min(b1):0.01:min(b11)],'k:','LineWidth',0.1)
hold on
plot(b3fb.*ones(1,length([min(b1):0.01:b3fb])),[min(b1):0.01:b3fb],'k:','LineWidth',0.1)
hold on
plot(b2fb.*ones(1,length([min(b1):0.01:b2fb+0.01])),[min(b1):0.01:b2fb+0.01],'k:','LineWidth',0.1)
hold on
plot(b1fb,b1fb,'ko',b2fb,b2fb,'ko',b3fb,b3fb,'ko','MarkerSize',02)
hold on
plot(max(b11).*ones(1,length([min(b1):0.01:max(b11)])),[min(b1):0.01:max(b11)],'k:','LineWidth',0.1)
hold off
xlim([b1fb max(b11)+0.02])
ylim([b1fb max(b11)+0.02])
set(gca,'FontSize',05);
set(gca, 'Xtick', [], 'Ytick', [], 'box', 'off')
text(max(b11)-0.01,min(b1)-0.03,'$${d}_{\max}$$','Interpreter','Latex','FontSize',05)
text(b3fb-0.017,b1fb-0.03,'$${d}^{\ast}(3)$$','Interpreter','Latex','FontSize',05)
text(b2fb-0.019,b1fb-0.03,'$${d}^{\ast}(2)$$','Interpreter','Latex','FontSize',05)
text(bcrit-0.004,b1fb-0.03,'$${d}^c$$','Interpreter','Latex','FontSize',05)
text(min(b11)-0.025,b1fb-0.03,'$${d}_{\min}=0$$','Interpreter','Latex','FontSize',05)
text(min(b11)-0.049,min(b11),'$${d}^0(1)$$','Interpreter','Latex','FontSize',05)
text(min(b11)-0.049,min(b12),'$${d}^0(2)$$','Interpreter','Latex','FontSize',05)
text(min(b11)-0.049,min(b13),'$${d}^0(3)$$','Interpreter','Latex','FontSize',05)
text(min(b11)-0.049,max(b13)+0.02,'$${b}_{r}({d})$$','Interpreter','Latex','FontSize',05)

subplot(2,2,2)
plot(b1,TBR,'k','LineWidth',1)
hold on
plot(b1,b1,'color', [200 200 200]/255,'LineWidth',1)
hold on
plot(bcrit.*ones(1,length([tau1fb:0.01:min(TBR)])),[tau1fb:0.01:min(TBR)],'k:','LineWidth',0.1)
hold on
plot((bcrit-0.075).*ones(1,length([tau1fb:0.01:max(TBR)-0.05])),[tau1fb:0.01:max(TBR)-0.055],'k:','LineWidth',0.1)
hold on
plot(max(b13)*ones(1,length([min(b1):0.01:max(b1)])),[min(b1):0.01:max(b1)],'k:','LineWidth',0.1)
hold off
set(gca,'FontSize',05);
set(gca, 'Xtick', [], 'Ytick', [], 'box', 'off')
xlim([b1fb max(b11)+0.02])
ylim([min(b1) max(b11)+0.02])
set(gca,'XTick',[], 'YTick', [])
text(max(b11)-0.01,min(b1)-0.03,'$$d_{\max}$$','Interpreter','Latex','FontSize',05)
text(b1fb-0.024,min(b1)-0.03,'$$d_{\min}=0$$','Interpreter','Latex','FontSize',05)
text(bcrit-0.088,min(b1)-0.03,'$$\tilde{d}$$','Interpreter','Latex','FontSize',05)
text(bcrit-0.004,min(b1)-0.03,'$$d^c$$','Interpreter','Latex','FontSize',05)
text(min(b11)-0.075,max(b11)+0.02,'$$d$$,BR($$d$$)','Interpreter','Latex','FontSize',05)

